﻿<div class="container header">
    <div class="row">
        <div class="col-md-3">
            <a href="~/">
                <img src="~/Content/Default/Images/logo.png" /></a>
        </div>
        <div class="col-md-6">
            <ul class="quote">
                <li class="br-left">&nbsp;</li>
                <li style="width: 80%;">
                    <div class="NWNTTicker">
                        <ul>
                            @foreach (string str in ViewBag.Quotes)
                            {
                                <li class="text">@str</li>
                            }
                            @*<li class="text">Mental health is a state of well-being in which an individual realizes his or her own abilities, can cope with the normal stresses of life, can work productively and is able to make a contribution to his or her community 1</li>
                            <li class="text">Mental health is a state of well-being in which an individual realizes his or her own abilities, can cope with the normal stresses of life, can work productively and is able to make a contribution to his or her community 2</li>
                            <li class="text">Mental health is a state of well-being in which an individual realizes his or her own abilities, can cope with the normal stresses of life, can work productively and is able to make a contribution to his or her community 3</li>*@
                        </ul>
                    </div>
                </li>
                <li class="br-right">&nbsp;</li>
            </ul>
        </div>
        <div class="col-md-3">
            <div class="social-media">
                <ul>
                    <li><a class="linkedin" href="http://www.linkedin.com/company/no-worry-no-tension?trk=biz-analytics-hyc-co-name" target="_blank"></a></li>
                    <li><a class="twitter" href="https://twitter.com/nwnttweet" target="_blank"></a></li>
                    <li><a class="youtube" href="http://www.youtube.com/user/noworrynotension?feature=results_main" target="_blank"></a></li>
                    <li><a class="fb" href="https://www.facebook.com/noworrynotension" target="_blank"></a></li>
                </ul>
            </div>
            <div class="top-search">
                <a class="ico-search" href="#"></a>
                <input type="search" placeholder="search" />
            </div>
        </div>
    </div>
</div>

<!-- client header start -->
<div class="client-header">
    <div class="container">
        <div class="row">
            <div class="col-md-3">@*<a class="partner-logo" href="#"><img src="~/Content/Default/Images/logo_partner.png" /></a>*@</div>
            <div class="col-md-9">
                @*@Html.Partial("_LoginPartial")*@
                <ul class="user-nav partner">
                    @if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.User.Identity.Name))
                    {
                        <li>Welcome to</li>
                        <li>
                            <div class="dropdown">
                                <a id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="javascript:void(0)">
                                    @Html.Label(string.IsNullOrEmpty(System.Web.HttpContext.Current.User.Identity.Name) ? "Guest" : System.Web.HttpContext.Current.User.Identity.Name, new { @class = "user-name" }) <span class="caret"></span>
                                </a>
                                @if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.User.Identity.Name))
                                {
                                    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                                        @*<li><a href="~/Home/ChangePassword"><span class="glyphicon glyphicon-lock"></span>Change Password</a></li>*@
                                        <li><a href="~/Home/userprofile"><span class="glyphicon glyphicon-user"></span>View Profile</a></li>
                                    </ul>
                                }
                            </div>
                        </li>
                        <li class="divider">&nbsp;</li>
                    }
                    @if (string.IsNullOrEmpty(System.Web.HttpContext.Current.User.Identity.Name))
                    {
                        <li>
                            <a href="javascript:void(0)" class="btn-regsign">Sign In | Register new user?</a>
                        </li>
                    }
                    else
                    {
                        @*<li><a href="~/Home/userprofile">My Dashboard</a></li>
                        
                        <li class="divider">&nbsp;</li>*@
                        <li>@Html.ActionLink("Sign Out", "Logoff", "Home")</li>
                    }
                </ul>
            </div>
        </div>
    </div>
    <!-- sign register panel start -->
    <div class="regsign-panel">
        <div class="row">
            <div class="col-md-4">
                <h2>Sign in with social Id</h2>
                <fb:login-button scope="public_profile,email" data-size="large" onlogin="checkLoginState();">
                </fb:login-button>

                <div id="status">
                </div>
                <div id="gConnect">
                    <!--data-scope="https://www.googleapis.com/auth/plus.login"-->
                    <button class="g-signin"
                        data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email"
                        data-requestvisibleactions="http://schemas.google.com/AddActivity"
                        data-clientid="756717820166-k69smrfmdgeal8okrsc8sefllf1gasr8.apps.googleusercontent.com"
                        data-accesstype="offline"
                        data-callback="onSignInCallback"
                        data-theme="dark"
                        data-cookiepolicy="single_host_origin">
                    </button>
                </div>
                <div id="authOps" style="display: none">
                    <h2>User is now signed in to the app using Google+</h2>
                    <p>
                        If the user chooses to disconnect, the app must delete all stored
                        information retrieved from Google for the given user.
                    </p>
                    <button id="disconnect">Disconnect your Google account from this app</button>
                    <h2>User's profile information</h2>
                    <p>
                        This data is retrieved client-side by using the Google JavaScript API
                        client library.
                    </p>
                    <div id="profile"></div>
                    <h2>User's friends that are visible to this app</h2>
                    <p>
                        This data is retrieved from your server, where your server makes
                        an authorized HTTP request on the user's behalf.
                    </p>
                    <p>
                        If your app uses server-side rendering, this is the section you
                        would change using your server-side templating system.
                    </p>
                    <div id="visiblePeople"></div>
                    <h2>Authentication Logs</h2>
                    <pre id="authResult"></pre>
                </div>
                <script>
                    // This is called with the results from from FB.getLoginStatus().
                    function statusChangeCallback(response) {
                        console.log('statusChangeCallback');
                        console.log(response);
                        // The response object is returned with a status field that lets the
                        // app know the current login status of the person.
                        // Full docs on the response object can be found in the documentation
                        // for FB.getLoginStatus().
                        if (response.status === 'connected') {
                            // Logged into your app and Facebook.
                            testAPI();
                        } else if (response.status === 'not_authorized') {
                            // The person is logged into Facebook, but not your app.
                            document.getElementById('status').innerHTML = 'Please log ' +
                              'into this app.';
                        } else {
                            // The person is not logged into Facebook, so we're not sure if
                            // they are logged into this app or not.
                            document.getElementById('status').innerHTML = 'Please log ' +
                              'into Facebook.';
                        }
                    }

                    // This function is called when someone finishes with the Login
                    // Button.  See the onlogin handler attached to it in the sample
                    // code below.
                    function checkLoginState() {
                        FB.getLoginStatus(function (response) {
                            statusChangeCallback(response);
                        });
                    }

                    window.fbAsyncInit = function () {
                        FB.init({
                            appId: '379564472190760',
                            cookie: true,  // enable cookies to allow the server to access
                            // the session
                            xfbml: true,  // parse social plugins on this page
                            version: 'v2.1' // use version 2.1
                        });

                        // Now that we've initialized the JavaScript SDK, we call
                        // FB.getLoginStatus().  This function gets the state of the
                        // person visiting this page and can return one of three states to
                        // the callback you provide.  They can be:
                        //
                        // 1. Logged into your app ('connected')
                        // 2. Logged into Facebook, but not your app ('not_authorized')
                        // 3. Not logged into Facebook and can't tell if they are logged into
                        //    your app or not.
                        //
                        // These three cases are handled in the callback function.

                        FB.getLoginStatus(function (response) {
                            statusChangeCallback(response);
                        });

                    };

                    // Load the SDK asynchronously
                    (function (d, s, id) {
                        var js, fjs = d.getElementsByTagName(s)[0];
                        if (d.getElementById(id)) return;
                        js = d.createElement(s); js.id = id;
                        js.src = "//connect.facebook.net/en_US/sdk.js";
                        fjs.parentNode.insertBefore(js, fjs);
                    }(document, 'script', 'facebook-jssdk'));

                    // Here we run a very simple test of the Graph API after login is
                    // successful.  See statusChangeCallback() for when this call is made.
                    function testAPI() {
                        console.log('Welcome!  Fetching your information.... ');
                        FB.api('/me', function (response) {
                            console.log('Successful login for: ' + response.name);
                            document.getElementById('status').innerHTML =
                              'Thanks for logging in, ' + response.name + '!' + ' first name' + response.first_name + ' email' + response.email + ' gender' + response.gender + ' id' + response.id + ' lastname' + response.last_name;
                        });
                    }
                </script>
                <!--
                  Below we include the Login Button social plugin. This button uses
                  the JavaScript SDK to present a graphical Login button that triggers
                  the FB.login() function when clicked.
                -->

                <script type="text/javascript">

                    function login() {
                        var loginText = $('#userLogin').val();
                        var passwordText = $('#userPassword').val();
                        $.ajax({
                            url: "../home/login",
                            //productIds, IEnumerable<int> yearIds, int pageNumber
                            //UserLogin, string UserPassword
                            data: JSON.stringify({ UserLogin: loginText, UserPassword: passwordText }),
                            contentType: "application/json",
                            type: "POST",
                            success: function (data, textStatus, XHR) {
                                if (data.result === 'Success') {
                                    window.location.reload();
                                }
                                else {
                                    window.showToast(data.message, 'Login', 4);
                                }
                            },
                            error: function (XHR, textStatus, errorThrown) {
                                //var msg = 'Error while saving [Query].';                     
                            }
                        });
                        return false;
                    }
                    $(document).ready(function () {
                        if (document.location.href.toLowerCase().indexOf('returnurl') > -1) {
                            $(".regsign-panel").toggle("slow")
                        }
                    });
                </script>
            </div>
            <div id="newRegistration" class="col-md-4" style="border-left: solid 1px #ccc;">

                <div class="form-group">
                    <h2>Register New User</h2>
                    <p>New to No Warry No Tension? Create an account to get started today.</p>
                    @*<input type="button" value="Create My Account" class="btn btn-primary" />*@
                    <!-- Large modal start  -->
                    <button class="btn btn-primary" onclick="ShowDialog();">Create My Account</button>
                    <!-- Large modal end-->
                </div>
            </div>
            @*@using (Html.BeginForm("Login", "Home", FormMethod.Post, new { name = "LoginFrom", id = "LoginFrom" }))
            {
                *@<div class="col-md-4" style="border-left: solid 1px #ccc;">
                    <h2>Sign In</h2>
                    <div>@ViewBag.ErrorMessage</div>
                    <div class="form-group">
                        <div class="col-md-12">
                            @Html.TextBox("userLogin", null, new { @placeholder = "User Name", @class = "form-control", @required = "required" })
                            @Html.ValidationMessage("userLogin")
                        </div>
                    </div>
                    <div class="form-group">
                        <div class=" col-md-12">
                            @Html.Password("userPassword", null, new { @placeholder = "Password", @class = "form-control", @required = "required" })
                            @Html.ValidationMessage("userPassword")
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-12">@Html.ActionLink("Forget Password?", "ForgotPassword", "Home")</div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-12">
                            <input id="SubmitLogin" type="submit" value="Sign In" onclick="javascript: return login();" class="btn btn-primary" />
                        </div>
                    </div>
                </div>
           @* }*@
        </div>
    </div>
    <!-- sign register panel end -->
</div>
<!-- client header end -->
